namespace CaltechSoft.Service.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class ChangeProcedure : DbMigration
    {
        public override void Up()
        {
            DropForeignKey("dbo.ProcedureItems", "CertificateStandard_CertificateStandardId", "dbo.CertificateStandard");
            DropIndex("dbo.ProcedureItems", new[] { "CertificateStandard_CertificateStandardId" });
            DropColumn("dbo.ProcedureItems", "StandardId");
            RenameColumn(table: "dbo.ProcedureItems", name: "CertificateStandard_CertificateStandardId", newName: "StandardId");
            AlterColumn("dbo.ProcedureItems", "StandardId", c => c.Int(nullable: false));
            CreateIndex("dbo.ProcedureItems", "StandardId");
            AddForeignKey("dbo.ProcedureItems", "StandardId", "dbo.CertificateStandard", "CertificateStandardId", cascadeDelete: true);
        }
        
        public override void Down()
        {
            DropForeignKey("dbo.ProcedureItems", "StandardId", "dbo.CertificateStandard");
            DropIndex("dbo.ProcedureItems", new[] { "StandardId" });
            AlterColumn("dbo.ProcedureItems", "StandardId", c => c.Int());
            RenameColumn(table: "dbo.ProcedureItems", name: "StandardId", newName: "CertificateStandard_CertificateStandardId");
            AddColumn("dbo.ProcedureItems", "StandardId", c => c.Int(nullable: false));
            CreateIndex("dbo.ProcedureItems", "CertificateStandard_CertificateStandardId");
            AddForeignKey("dbo.ProcedureItems", "CertificateStandard_CertificateStandardId", "dbo.CertificateStandard", "CertificateStandardId");
        }
    }
}
